#include <xp/bas/sysapi.h>
#include <xp/bas/locale.h>
#include <xp/bas/stdio.h>

#ifdef __linux
#include <mcheck.h>
#endif

int xp_main (int argc, xp_char_t* argv[])
{
	xp_char_t buf[XP_PATH_MAX + 1];

#ifdef __linux
	mtrace ();
#endif

	if (xp_setlocale () == -1) {
		xp_printf (XP_TEXT("cannot setlocale\n"));
		return -1;
	}

	if (xp_getpnm (argv[0], buf, xp_countof(buf)) == -1) {
		xp_printf (XP_TEXT("cannot getpnm\n"));
		return -1;
	}

	xp_printf (XP_TEXT("pnm: [%s]\n"), buf);
#ifdef __linux
	muntrace ();
#endif
	return 0;
}
